package com.zk.shop.servlet.user;

import com.zk.shop.entity.User;
import com.zk.shop.service.Impl.UserServiceImpl;
import com.zk.shop.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @ClassName ShowUserServlet
 * @Description TODO
 * @Author 来永刚
 * @Date 2019/9/29 0029下午 6:32
 * @Version 1.0
 **/
@WebServlet("/user/ShowUserServlet")
public class ShowUserServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserService userService = new UserServiceImpl();
        List<User> users = userService.showUser();
        resp.getWriter().println(users);
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }
}
